<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
	<script>
	//关闭谈出窗口	
	function closeDag(){
		$('#goodChoeseDiv').dialog('close'); 
	}
	//仅保存订单
	function onlySave(){
		if($('#list_data').datagrid('getSelected')){
			
				var selectedRow = $('#list_data').datagrid('getSelections');
				
				for(var i=0;i<selectedRow.length;i++){
					var index = $("#tt2").datagrid("getData").rows.length;
					var spinerId = new Date().getTime()+"index"+parseInt(index+1);
					var spinerPrice= new Date().getTime()+"price"+parseInt(index+1);
					var myRow=new Object();
						myRow.name=selectedRow[i].name;
						myRow.price="<input id='"+spinerPrice+"' style='width:80px;' value='"+selectedRow[i].price+"' required='required'>";
						myRow.num="<input id='"+spinerId+"' style='width:80px;' required='required'>";
					//在行末尾追加一行
					$("#tt2").datagrid('insertRow', {
                        index: index,
                        row: myRow
                    });
                    
               		//添加微调器
               		$("#"+spinerId).numberspinner({
							min: 0,
							max: 99999,
							precision:0,
               				value: 1,
							editable: true
					});
               		
               		$("#"+spinerPrice).numberspinner({
						min: 0,
						max: 99999,
						precision:0,
						editable: true
				});
               		
               		spinerArr.push(spinerId);
               		spinerPriceArr.push(spinerPrice);
				}
			
			$('#goodChoeseDiv').dialog('close'); 
		}else{
			$.messager.alert('提示','请选择菜单！')
		}
	}
	
	
	$(function(){
		$('#list_data').datagrid({  
	        title:'菜单列表',  
	        iconCls:'icon-edit',// 图标
	        width: 'auto',  
	        height:370,  
	        nowrap: false,  
	        striped: true,  
	        border: true,  
	        loadMsg:'数据加载中请稍后……',
	        collapsible:true,// 是否可折叠的
	        fit: false,// 自动大小
	        url:'<%=path %>/menu/list',  
	        remoteSort:false,   
	        singleSelect:false,// 是否单选
	        pagination:true,// 分页控件
	        pageSize: 100,// 每页显示的记录条数，默认为10
	        pageList: [100,500,1000],// 可以设置每页记录条数的列表
	        rownumbers:true,// 行号
	        columns:[[
	                  {field:'name',title:'菜名',width:200,align:'center'},
	                  {field:'price',title:'单价',width:100,align:'center'},
	                  {field:'descption',title:'描述',width:350,align:'center'}
	                  ]],
	        frozenColumns:[[  
	            {field:'id',checkbox:true}  
	        ]]
	    });  

		var p = $('#list_data').datagrid('getPager');  
	    $(p).pagination({  
	        pageSize: 100,// 每页显示的记录条数，默认为10
	        pageList: [100,500,1000],// 可以设置每页记录条数的列表
	        beforePageText: '第',// 页数文本框前显示的汉字
	        afterPageText: '页     共{pages}页',  
	        displayMsg: '当前显示 {from} - {to} 条记录   共 {total}条记录'
	    }); 
	    
	});    
	
	function rebackUiStore(){
		rebackUi();
	}
	</script>
		<form id="queryForm" name="queryForm" method="post" >
			<div id="tab_bd2">
				<div class="title">
					<div class="left">
						查询筛选
					</div>
				</div>
				<div class="frame">
					<table width="100%" border="0" cellpadding="1" cellspacing="1" bordercolor="#CCCCCC" bgcolor="#CCCCCC" align="center">
						<tr>
							<td class="lbg" width="120">
								菜名：
							</td>
							<td>
								<input name="outMenu.name" id="name" type="text" size="20">
							</td>
							<td class="lbg" width="60" colspan="8">
								<a id="btn" href="javascript:queryUi()" class="easyui-linkbutton" data-options="iconCls:'icon-search'">查询</a>
								<a id="btn" href="javascript:rebackUiStore()" class="easyui-linkbutton" data-options="iconCls:'icon-reload'">重置</a>
							</td>
						</tr>
					</table>
				</div>
			</div>
		</form>
		<table id="list_data"  > </table>
			<div style="text-align: center;">
					<a href="javascript:onlySave()" class="easyui-linkbutton pad" iconCls="icon-save">确定</a>
					<a href="javascript:closeDag()" class="easyui-linkbutton pad" iconCls="icon-reload">返回</a>
			</div>
				
	
